package com.nettest.dao.system;

import org.hibernate.SQLQuery;
import org.springframework.stereotype.Service;

import com.nettest.entity.system.Menu;
import com.nettest.service.BaseServiceForHibernate;
@Service
public class MenuDao extends BaseServiceForHibernate<Menu> {

	public String selectMaxMenuId(String nodeId) {
		String sql = "SELECT max(menu_id) menuId" +
				"           FROM t_menu" +
				"          where parent_id = :menuId";
		SQLQuery query = super.getSession().createSQLQuery(sql);
		Object result = query.setString("menuId", nodeId).uniqueResult();
		return String.valueOf(result);
	}
}
